{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Overview of LAT Data Analysis Tools\n",
    "Through a collaborative effort between the Fermi Science Support Center and the LAT instrument team, a suite of instrument specific tools has been developed for public release.\n",
    "\n",
    "This software will be distributed and maintained by the FSSC.\n",
    "\n",
    "It has been designed within the framework of the HEADAS FTOOLS methodology to ensure cross-mission compatibilities wherever possible and to minimize the learning curve for users of other high-energy astrophysics mission data sets.\n",
    "\n",
    "The general analysis flow is illustrated in this graphic:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src='https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/images/overview/STflow_new.jpg'>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The analysis threads are part of a hierarchical documentation set offered in support of Fermi data analysis.\n",
    "\n",
    "The threads are basically \"cookbook\" analysis examples which could, for example, be followed verbatim and then repeated but substituting data sets and observational scenarios of your own choosing.\n",
    "\n",
    "The other components of the documentation set are a broad overview guide, the \"[Cicerone](https://fermi.gsfc.nasa.gov/ssc/data/analysis/documentation/Cicerone/)\", and individual reference guides - based on the familiar \"fhelp\" model - for each science tool.\n",
    "\n",
    "The following set of Fermi-specific tools are used to analyze LAT data; some tools, such as **gtbin**, can also process GBM data products.\n",
    "\n",
    "Tool groups include: General, Likelihood, Source Identification, GRB, Pulsar, Solar System Sources, Observation Simulation."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# General\n",
    "\n",
    "[gtselect](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtselect.txt)\tPerforms selection cuts on event data files.\n",
    "\n",
    "[gtbin](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtbin.txt)\tBins GBM or LAT event lists in time, energy, and/or space to produce light-curves, spectra, count cubes or count maps, respectively.\n",
    "\n",
    "[gtbkg](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtbkg.txt)\tCreates a background spectrum file (PHA1 format).\n",
    "\n",
    "[gtexpcube2](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtexpcube2.txt)\tGenerates an exposure map, or a set of exposure maps for different energies, from a livetime cube written by gtltcube.\n",
    "\n",
    "[gtexposure](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtexposure.txt)\tGiven a counts light curve prepared using gtbin for a specific location on the sky, this tool computes the exposure (cm2-s) associated with each time bin,allowing for a light curve in photons/s to be computed.\n",
    "\n",
    "[gtirfs](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtirfs.txt)\tGive the list of possible irfs\n",
    "\n",
    "[gtltcube](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtltcube.txt)\tCalculates integrated livetime as a function of sky position and off-axis angle.\n",
    "\n",
    "[gtltsum](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtltsum.txt)\tAdds together livetime cubes produced by gtltcube.\n",
    "\n",
    "[gtmktime](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtmktime.txt)\tCreate Good Time Intervals (GTIs) based on selections made using the spacecraft data file variables.\n",
    "\n",
    "[gtpsf](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtpsf.txt)\tCalculates the effective point spread function, as a function of energy at a given source location, averaged over an observation.\n",
    "\n",
    "[gtvcut](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtvcut.txt)\tThis tool displays a summary of the Data Sub-Space keywords."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Likelihood\n",
    "\n",
    "[gtdiffrsp](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtdiffrsp.txt)\tCalculates the integral over solid angle of a diffuse source model convolved with the instrumental response function.\n",
    "\n",
    "[gtexpmap](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtexpmap.txt)\tCalculates exposure maps for unbinned likelihood analysis.\n",
    "\n",
    "[gtfindsrc](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtfindsrc.txt)\tOptimizes a point source location using the likelihood test-statistic.\n",
    "\n",
    "[gtlike](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtlike.txt)\tPerforms unbinned or binned likelihood analysis of LAT data.\n",
    "\n",
    "[gtltcube](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtltcube.txt)\tCalculates integrated livetime as a function of sky position and off-axis angle.\n",
    "\n",
    "[gtmodel](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtmodel.txt)\tCreates a model counts map based on a binned likelihood fit.\n",
    "\n",
    "[gtsrcmaps](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtsrcmaps.txt)\tConvolves source model components with instrument response.\n",
    "\n",
    "[gtsrcprob](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtsrcprob.txt)\tComputes source component probabilities for event data.\n",
    "\n",
    "[gttsmap](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gttsmap.txt)\tCalculates test-statistic map for source localization and detection.\n",
    "\n",
    "[modeleditor](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/modeleditor.txt)\tCreate model files for use as input to the Fermi likelihood estimation program."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Source Identification\n",
    "\n",
    "[gtsrcid](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtsrcid.txt)     Creates a counterpart candidate catalog by correlating the objects from a list of detected sources with the objects of an existing source catalog, such as the 3EG catalog."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Gamma-ray Burst Analysis\n",
    "\n",
    "[gtbin](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtbin.txt)\tBins GBM or LAT event lists in time, energy, and/or space to produce light-curves, spectra, count cubes or count maps, respectively.\n",
    "\n",
    "[gtbindef](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtbindef.txt)\tGenerate an energy or time bin definition (FITS) file to be used with gtbin.\n",
    "\n",
    "[gtrspgen](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtrspgen.txt)    Creates a \"Detector Response Matrix\" (DRM or RSP) FITS file from the multi-dimensional response functions.\n",
    "\n",
    "[gtburstfit](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtburstfit.txt)  Analyzes burst light curves by applying a Bayesian algorithm to determine the optimum set of blocks to follow the burst profile shape, then optionally fitting a model to the data using the Bayesian Block definitions to determine the number of model components and initial values for the model parameters."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pulsar Analysis\n",
    "\n",
    "[gtpsearch](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtpsearch.txt)\tSearches for pulsations at frequencies near to a known, guessed or estimated reference frequency.\n",
    "\n",
    "[gtpspec](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtpspec.txt)\tSearches for pulsations in wide frequency range using the Discrete Fast Fourier Transfer (FFT) technique.\n",
    "\n",
    "[gtptest](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtptest.txt)\tApplies statistical tests to a series of pulse phase values stored in given event file(s).\n",
    "\n",
    "[gtpphase](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtpphase.txt)\tComputes a pulse phase for each event in input event file(s), and writes it to a FITS column in the file(s).\n",
    "\n",
    "[gtophase](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtoPhase.txt)\tComputes an orbital phase for each event in input event file(s), and writes it to a FITS column in the file(s).\n",
    "\n",
    "[gtephem](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtephem.txt)\tComputes and displays a pulsar's frequency ephemeris for a given pulsar and instant of time.\n",
    "\n",
    "[gtpulsardb](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtpulsardb.txt)\tCCreates, filters, and/or combines pulsar ephemerides database files.\n",
    "\n",
    "[gtbary](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtbary.txt)\tPerforms barycentric or geocentric corrections to photon arrival times."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Solar System Sources\n",
    "\n",
    "[gtltcubesun](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtltcubesun.txt)\tCalculates integrated livetime as a function of sky position, instrument angle and distance from a solar system body (sun or moon).\n",
    "\n",
    "[gtltsumsun](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtltsumsun.txt)\tAdds together livetime cubes produced by gtltcubesun.\n",
    "\n",
    "[gtexphpsun](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtexphpsun.txt)\tIt calculates the exposure for different energies as a function of distance from the Sun or Moon using the livetime cube generated by gtltcubesun. The map is used by gtsuntemp to calculate the exposure weighted average intensity of the Sun or the Moon.\n",
    "\n",
    "[gtsuntemp](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtsuntemp.txt)\tGenerates the average intensity skymaps as a function of energy for the Sun or the Moon. The output fits file can be used in likelihood analysis in a similar fashion as the diffuse emission model."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Observation Simulation\n",
    "\n",
    "[gtobssim](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtobssim.txt)\tGenerate photon events from astrophysical sources and process those photons according to the specified instrument response functions.\n",
    "\n",
    "[gtorbsim](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/gtorbsim.txt)\tGenerate spacecraft orbit and attitude data for a variety of pointing or survey mode strategies.\n",
    "\n",
    "[modeleditor](https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/help/modeleditor.txt)\tCreate model files for use as input to the Fermi likelihood estimation program."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
